package ntd.util.frame.task.handle.fm.enums;

import cn.hutool.core.collection.ListUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.List;

/**
 * 数据异常类型
 */
@AllArgsConstructor
public enum EnumDataAnomaly {

    NONE("正常", 0),
    ALARM_TOP("上限告警", 1),
    ALARM_DOWN("下限告警", 1),
    OVER_TOP("上限超标", 2),
    OVER_DOWN("下限超标", 2),
    EXCEPTION_TOP("上限异常", 3),
    EXCEPTION_DOWN("下限异常", 3),
    ;

    @Getter
    private String memo;
    /**
     *  异常级别
     *  0：正常
     *  1：告警
     *  2：超标
     *  3：异常
     */
    @Getter
    private Integer exceptionLevel;
    /**
     * 是否是异常
     * @return
     */
    public boolean isException() {
        List<EnumDataAnomaly> enumDataAnomalies = ListUtil.of(OVER_TOP, OVER_DOWN, EXCEPTION_TOP, EXCEPTION_DOWN);
        return enumDataAnomalies.contains(this);
    }

}
